Skip to content

Expand pip commands into separate entries #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

jplock
Copy link
Contributor

@jplock jplock commented Nov 27, 2019

My serverless.yml file looks like:

pythonRequirements:
    pythonBin: ".venv/bin/python3"
    invalidateCaches: true
    pipCmdExtraArgs:
      - "--trusted-host pypi.python.org"
      - "--trusted-host pypi.org"
      - "--trusted-host files.pythonhosted.org"

Before this change, the generated pipCmds looked like:

pipCmds: [
  [
    '.venv/bin/python3',
    '-m',
    'pip',
    'install',
    '--trusted-host pypi.python.org',
    '--trusted-host pypi.org',
    '--trusted-host files.pythonhosted.org',
    '-t',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc',
    '-r',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc/requirements.txt',
    '--cache-dir',
    '~/Library/Caches/serverless-python-requirements/downloadCacheslspyc'
  ]
]

And resulted in this error:

Error --------------------------------------------------
 
  Error: STDOUT: 
  
  STDERR: 
  Usage:   
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] <requirement specifier> [package-index-options] ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] -r <requirements file> [package-index-options] ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] [-e] <vcs project url> ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] [-e] <local project path> ...
    ~/envs/git/myproject/api/.venv/bin/python3 -m pip install [options] <archive url/path> ...
  
  no such option: --trusted-host pypi.python.org
  
      at ~/envs/git/myproject/api/node_modules/serverless-python-requirements/lib/pip.js:324:13
      at Array.forEach (<anonymous>)
      at installRequirements (~/envs/git/myproject/api/node_modules/serverless-python-requirements/lib/pip.js:311:28)

After this change, the pipCmds looks like which seems to pass successfully to pip:

pipCmds: [
  [
    '.venv/bin/python3',
    '-m',
    'pip',
    'install',
    '--trusted-host',
    'pypi.python.org',
    '--trusted-host',
    'pypi.org',
    '--trusted-host',
    'files.pythonhosted.org',
    '-t',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc',
    '-r',
    '~/Library/Caches/serverless-python-requirements/01dde858536f71d67120395d14566ab6f37cce626069dc5d99d750fcd314e5c2_slspyc/requirements.txt',
    '--cache-dir',
    '~/Library/Caches/serverless-python-requirements/downloadCacheslspyc'
  ]
]

@jplock
Copy link
Contributor Author

jplock commented Dec 2, 2019

The build failures don't seem related to this change.

@jplock
Copy link
Contributor Author

jplock commented Dec 5, 2019

@dschep any thoughts on this one?

@dschep dschep merged commit 64e20db into serverless:master Dec 6, 2019
@jplock jplock deleted the patch-1 branch December 7, 2019 00:32
@jplock
Copy link
Contributor Author

jplock commented Dec 18, 2019

@dschep I was wondering when the next release is going to be released that includes this change? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants